/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    cn-qingdao = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-beijing = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-chengdu = 'dbs-api.cn-chengdu.aliyuncs.com',
    cn-zhangjiakou = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-huhehaote = 'dbs-api.cn-huhehaote.aliyuncs.com',
    cn-hangzhou = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shanghai = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shenzhen = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-hongkong = 'dbs-api.cn-hangzhou.aliyuncs.com',
    ap-southeast-1 = 'dbs-api.ap-southeast-1.aliyuncs.com',
    ap-southeast-2 = 'dbs-api.ap-southeast-2.aliyuncs.com',
    ap-southeast-3 = 'dbs-api.ap-southeast-3.aliyuncs.com',
    ap-southeast-5 = 'dbs-api.ap-southeast-5.aliyuncs.com',
    ap-northeast-1 = 'dbs-api.ap-northeast-1.aliyuncs.com',
    us-west-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    us-east-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    eu-central-1 = 'dbs-api.eu-central-1.aliyuncs.com',
    cn-hangzhou-finance = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shanghai-finance-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shenzhen-finance-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    ap-south-1 = 'dbs-api.ap-south-1.aliyuncs.com',
    eu-west-1 = 'dbs-api.eu-west-1.aliyuncs.com',
    me-east-1 = 'dbs-api.me-east-1.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('dbs', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ConfigureBackupPlanRequest {
  autoStartBackup?: boolean(name='AutoStartBackup'),
  backupGatewayId?: long(name='BackupGatewayId'),
  backupLogIntervalSeconds?: int32(name='BackupLogIntervalSeconds'),
  backupObjects?: string(name='BackupObjects'),
  backupPeriod?: string(name='BackupPeriod'),
  backupPlanId?: string(name='BackupPlanId'),
  backupPlanName?: string(name='BackupPlanName'),
  backupRateLimit?: long(name='BackupRateLimit'),
  backupRetentionPeriod?: int32(name='BackupRetentionPeriod'),
  backupSpeedLimit?: long(name='BackupSpeedLimit'),
  backupStartTime?: string(name='BackupStartTime'),
  backupStorageType?: string(name='BackupStorageType'),
  backupStrategyType?: string(name='BackupStrategyType'),
  clientToken?: string(name='ClientToken'),
  crossAliyunId?: string(name='CrossAliyunId'),
  crossRoleName?: string(name='CrossRoleName'),
  duplicationArchivePeriod?: int32(name='DuplicationArchivePeriod'),
  duplicationInfrequentAccessPeriod?: int32(name='DuplicationInfrequentAccessPeriod'),
  enableBackupLog?: boolean(name='EnableBackupLog'),
  OSSBucketName?: string(name='OSSBucketName'),
  ownerId?: string(name='OwnerId'),
  resourceGroupId?: string(name='ResourceGroupId'),
  sourceEndpointDatabaseName?: string(name='SourceEndpointDatabaseName'),
  sourceEndpointIP?: string(name='SourceEndpointIP'),
  sourceEndpointInstanceID?: string(name='SourceEndpointInstanceID'),
  sourceEndpointInstanceType?: string(name='SourceEndpointInstanceType'),
  sourceEndpointOracleSID?: string(name='SourceEndpointOracleSID'),
  sourceEndpointPassword?: string(name='SourceEndpointPassword'),
  sourceEndpointPort?: int32(name='SourceEndpointPort'),
  sourceEndpointRegion?: string(name='SourceEndpointRegion'),
  sourceEndpointUserName?: string(name='SourceEndpointUserName'),
}

model ConfigureBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ConfigureBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ConfigureBackupPlanResponseBody(name='body'),
}

async function configureBackupPlanWithOptions(request: ConfigureBackupPlanRequest, runtime: Util.RuntimeOptions): ConfigureBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.autoStartBackup)) {
    query['AutoStartBackup'] = request.autoStartBackup;
  }
  if (!Util.isUnset(request.backupGatewayId)) {
    query['BackupGatewayId'] = request.backupGatewayId;
  }
  if (!Util.isUnset(request.backupLogIntervalSeconds)) {
    query['BackupLogIntervalSeconds'] = request.backupLogIntervalSeconds;
  }
  if (!Util.isUnset(request.backupObjects)) {
    query['BackupObjects'] = request.backupObjects;
  }
  if (!Util.isUnset(request.backupPeriod)) {
    query['BackupPeriod'] = request.backupPeriod;
  }
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupPlanName)) {
    query['BackupPlanName'] = request.backupPlanName;
  }
  if (!Util.isUnset(request.backupRateLimit)) {
    query['BackupRateLimit'] = request.backupRateLimit;
  }
  if (!Util.isUnset(request.backupRetentionPeriod)) {
    query['BackupRetentionPeriod'] = request.backupRetentionPeriod;
  }
  if (!Util.isUnset(request.backupSpeedLimit)) {
    query['BackupSpeedLimit'] = request.backupSpeedLimit;
  }
  if (!Util.isUnset(request.backupStartTime)) {
    query['BackupStartTime'] = request.backupStartTime;
  }
  if (!Util.isUnset(request.backupStorageType)) {
    query['BackupStorageType'] = request.backupStorageType;
  }
  if (!Util.isUnset(request.backupStrategyType)) {
    query['BackupStrategyType'] = request.backupStrategyType;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.crossAliyunId)) {
    query['CrossAliyunId'] = request.crossAliyunId;
  }
  if (!Util.isUnset(request.crossRoleName)) {
    query['CrossRoleName'] = request.crossRoleName;
  }
  if (!Util.isUnset(request.duplicationArchivePeriod)) {
    query['DuplicationArchivePeriod'] = request.duplicationArchivePeriod;
  }
  if (!Util.isUnset(request.duplicationInfrequentAccessPeriod)) {
    query['DuplicationInfrequentAccessPeriod'] = request.duplicationInfrequentAccessPeriod;
  }
  if (!Util.isUnset(request.enableBackupLog)) {
    query['EnableBackupLog'] = request.enableBackupLog;
  }
  if (!Util.isUnset(request.OSSBucketName)) {
    query['OSSBucketName'] = request.OSSBucketName;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.sourceEndpointDatabaseName)) {
    query['SourceEndpointDatabaseName'] = request.sourceEndpointDatabaseName;
  }
  if (!Util.isUnset(request.sourceEndpointIP)) {
    query['SourceEndpointIP'] = request.sourceEndpointIP;
  }
  if (!Util.isUnset(request.sourceEndpointInstanceID)) {
    query['SourceEndpointInstanceID'] = request.sourceEndpointInstanceID;
  }
  if (!Util.isUnset(request.sourceEndpointInstanceType)) {
    query['SourceEndpointInstanceType'] = request.sourceEndpointInstanceType;
  }
  if (!Util.isUnset(request.sourceEndpointOracleSID)) {
    query['SourceEndpointOracleSID'] = request.sourceEndpointOracleSID;
  }
  if (!Util.isUnset(request.sourceEndpointPassword)) {
    query['SourceEndpointPassword'] = request.sourceEndpointPassword;
  }
  if (!Util.isUnset(request.sourceEndpointPort)) {
    query['SourceEndpointPort'] = request.sourceEndpointPort;
  }
  if (!Util.isUnset(request.sourceEndpointRegion)) {
    query['SourceEndpointRegion'] = request.sourceEndpointRegion;
  }
  if (!Util.isUnset(request.sourceEndpointUserName)) {
    query['SourceEndpointUserName'] = request.sourceEndpointUserName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConfigureBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function configureBackupPlan(request: ConfigureBackupPlanRequest): ConfigureBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return configureBackupPlanWithOptions(request, runtime);
}

model CreateAndStartBackupPlanRequest {
  backupGatewayId?: long(name='BackupGatewayId'),
  backupLogIntervalSeconds?: int32(name='BackupLogIntervalSeconds'),
  backupMethod?: string(name='BackupMethod'),
  backupObjects?: string(name='BackupObjects'),
  backupPeriod?: string(name='BackupPeriod'),
  backupPlanId?: string(name='BackupPlanId'),
  backupPlanName?: string(name='BackupPlanName'),
  backupRateLimit?: long(name='BackupRateLimit'),
  backupRetentionPeriod?: int32(name='BackupRetentionPeriod'),
  backupSpeedLimit?: long(name='BackupSpeedLimit'),
  backupStartTime?: string(name='BackupStartTime'),
  backupStorageType?: string(name='BackupStorageType'),
  backupStrategyType?: string(name='BackupStrategyType'),
  clientToken?: string(name='ClientToken'),
  crossAliyunId?: string(name='CrossAliyunId'),
  crossRoleName?: string(name='CrossRoleName'),
  databaseRegion?: string(name='DatabaseRegion'),
  databaseType?: string(name='DatabaseType'),
  duplicationArchivePeriod?: int32(name='DuplicationArchivePeriod'),
  duplicationInfrequentAccessPeriod?: int32(name='DuplicationInfrequentAccessPeriod'),
  enableBackupLog?: boolean(name='EnableBackupLog'),
  fromApp?: string(name='FromApp'),
  instanceClass?: string(name='InstanceClass'),
  instanceType?: string(name='InstanceType'),
  OSSBucketName?: string(name='OSSBucketName'),
  ownerId?: string(name='OwnerId'),
  payType?: string(name='PayType'),
  period?: string(name='Period'),
  region?: string(name='Region'),
  resourceGroupId?: string(name='ResourceGroupId'),
  sourceEndpointDatabaseName?: string(name='SourceEndpointDatabaseName'),
  sourceEndpointIP?: string(name='SourceEndpointIP'),
  sourceEndpointInstanceID?: string(name='SourceEndpointInstanceID'),
  sourceEndpointInstanceType?: string(name='SourceEndpointInstanceType'),
  sourceEndpointOracleSID?: string(name='SourceEndpointOracleSID'),
  sourceEndpointPassword?: string(name='SourceEndpointPassword'),
  sourceEndpointPort?: int32(name='SourceEndpointPort'),
  sourceEndpointRegion?: string(name='SourceEndpointRegion'),
  sourceEndpointUserName?: string(name='SourceEndpointUserName'),
  storageRegion?: string(name='StorageRegion'),
  storageType?: string(name='StorageType'),
  usedTime?: int32(name='UsedTime'),
}

model CreateAndStartBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  createBackupSet?: boolean(name='CreateBackupSet'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  orderId?: string(name='OrderId'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateAndStartBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateAndStartBackupPlanResponseBody(name='body'),
}

async function createAndStartBackupPlanWithOptions(request: CreateAndStartBackupPlanRequest, runtime: Util.RuntimeOptions): CreateAndStartBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupGatewayId)) {
    query['BackupGatewayId'] = request.backupGatewayId;
  }
  if (!Util.isUnset(request.backupLogIntervalSeconds)) {
    query['BackupLogIntervalSeconds'] = request.backupLogIntervalSeconds;
  }
  if (!Util.isUnset(request.backupMethod)) {
    query['BackupMethod'] = request.backupMethod;
  }
  if (!Util.isUnset(request.backupObjects)) {
    query['BackupObjects'] = request.backupObjects;
  }
  if (!Util.isUnset(request.backupPeriod)) {
    query['BackupPeriod'] = request.backupPeriod;
  }
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupPlanName)) {
    query['BackupPlanName'] = request.backupPlanName;
  }
  if (!Util.isUnset(request.backupRateLimit)) {
    query['BackupRateLimit'] = request.backupRateLimit;
  }
  if (!Util.isUnset(request.backupRetentionPeriod)) {
    query['BackupRetentionPeriod'] = request.backupRetentionPeriod;
  }
  if (!Util.isUnset(request.backupSpeedLimit)) {
    query['BackupSpeedLimit'] = request.backupSpeedLimit;
  }
  if (!Util.isUnset(request.backupStartTime)) {
    query['BackupStartTime'] = request.backupStartTime;
  }
  if (!Util.isUnset(request.backupStorageType)) {
    query['BackupStorageType'] = request.backupStorageType;
  }
  if (!Util.isUnset(request.backupStrategyType)) {
    query['BackupStrategyType'] = request.backupStrategyType;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.crossAliyunId)) {
    query['CrossAliyunId'] = request.crossAliyunId;
  }
  if (!Util.isUnset(request.crossRoleName)) {
    query['CrossRoleName'] = request.crossRoleName;
  }
  if (!Util.isUnset(request.databaseRegion)) {
    query['DatabaseRegion'] = request.databaseRegion;
  }
  if (!Util.isUnset(request.databaseType)) {
    query['DatabaseType'] = request.databaseType;
  }
  if (!Util.isUnset(request.duplicationArchivePeriod)) {
    query['DuplicationArchivePeriod'] = request.duplicationArchivePeriod;
  }
  if (!Util.isUnset(request.duplicationInfrequentAccessPeriod)) {
    query['DuplicationInfrequentAccessPeriod'] = request.duplicationInfrequentAccessPeriod;
  }
  if (!Util.isUnset(request.enableBackupLog)) {
    query['EnableBackupLog'] = request.enableBackupLog;
  }
  if (!Util.isUnset(request.fromApp)) {
    query['FromApp'] = request.fromApp;
  }
  if (!Util.isUnset(request.instanceClass)) {
    query['InstanceClass'] = request.instanceClass;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.OSSBucketName)) {
    query['OSSBucketName'] = request.OSSBucketName;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.sourceEndpointDatabaseName)) {
    query['SourceEndpointDatabaseName'] = request.sourceEndpointDatabaseName;
  }
  if (!Util.isUnset(request.sourceEndpointIP)) {
    query['SourceEndpointIP'] = request.sourceEndpointIP;
  }
  if (!Util.isUnset(request.sourceEndpointInstanceID)) {
    query['SourceEndpointInstanceID'] = request.sourceEndpointInstanceID;
  }
  if (!Util.isUnset(request.sourceEndpointInstanceType)) {
    query['SourceEndpointInstanceType'] = request.sourceEndpointInstanceType;
  }
  if (!Util.isUnset(request.sourceEndpointOracleSID)) {
    query['SourceEndpointOracleSID'] = request.sourceEndpointOracleSID;
  }
  if (!Util.isUnset(request.sourceEndpointPassword)) {
    query['SourceEndpointPassword'] = request.sourceEndpointPassword;
  }
  if (!Util.isUnset(request.sourceEndpointPort)) {
    query['SourceEndpointPort'] = request.sourceEndpointPort;
  }
  if (!Util.isUnset(request.sourceEndpointRegion)) {
    query['SourceEndpointRegion'] = request.sourceEndpointRegion;
  }
  if (!Util.isUnset(request.sourceEndpointUserName)) {
    query['SourceEndpointUserName'] = request.sourceEndpointUserName;
  }
  if (!Util.isUnset(request.storageRegion)) {
    query['StorageRegion'] = request.storageRegion;
  }
  if (!Util.isUnset(request.storageType)) {
    query['StorageType'] = request.storageType;
  }
  if (!Util.isUnset(request.usedTime)) {
    query['UsedTime'] = request.usedTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAndStartBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAndStartBackupPlan(request: CreateAndStartBackupPlanRequest): CreateAndStartBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAndStartBackupPlanWithOptions(request, runtime);
}

model CreateBackupPlanRequest {
  backupMethod?: string(name='BackupMethod'),
  clientToken?: string(name='ClientToken'),
  databaseRegion?: string(name='DatabaseRegion'),
  databaseType?: string(name='DatabaseType'),
  fromApp?: string(name='FromApp'),
  instanceClass?: string(name='InstanceClass'),
  instanceType?: string(name='InstanceType'),
  ownerId?: string(name='OwnerId'),
  payType?: string(name='PayType'),
  period?: string(name='Period'),
  region?: string(name='Region'),
  resourceGroupId?: string(name='ResourceGroupId'),
  storageRegion?: string(name='StorageRegion'),
  storageType?: string(name='StorageType'),
  usedTime?: int32(name='UsedTime'),
}

model CreateBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  orderId?: string(name='OrderId'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateBackupPlanResponseBody(name='body'),
}

async function createBackupPlanWithOptions(request: CreateBackupPlanRequest, runtime: Util.RuntimeOptions): CreateBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupMethod)) {
    query['BackupMethod'] = request.backupMethod;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseRegion)) {
    query['DatabaseRegion'] = request.databaseRegion;
  }
  if (!Util.isUnset(request.databaseType)) {
    query['DatabaseType'] = request.databaseType;
  }
  if (!Util.isUnset(request.fromApp)) {
    query['FromApp'] = request.fromApp;
  }
  if (!Util.isUnset(request.instanceClass)) {
    query['InstanceClass'] = request.instanceClass;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.storageRegion)) {
    query['StorageRegion'] = request.storageRegion;
  }
  if (!Util.isUnset(request.storageType)) {
    query['StorageType'] = request.storageType;
  }
  if (!Util.isUnset(request.usedTime)) {
    query['UsedTime'] = request.usedTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createBackupPlan(request: CreateBackupPlanRequest): CreateBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return createBackupPlanWithOptions(request, runtime);
}

model CreateFullBackupSetDownloadRequest {
  backupSetDataFormat?: string(name='BackupSetDataFormat'),
  backupSetId?: string(name='BackupSetId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model CreateFullBackupSetDownloadResponseBody = {
  backupSetDownloadTaskId?: string(name='BackupSetDownloadTaskId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateFullBackupSetDownloadResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateFullBackupSetDownloadResponseBody(name='body'),
}

async function createFullBackupSetDownloadWithOptions(request: CreateFullBackupSetDownloadRequest, runtime: Util.RuntimeOptions): CreateFullBackupSetDownloadResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupSetDataFormat)) {
    query['BackupSetDataFormat'] = request.backupSetDataFormat;
  }
  if (!Util.isUnset(request.backupSetId)) {
    query['BackupSetId'] = request.backupSetId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFullBackupSetDownload',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createFullBackupSetDownload(request: CreateFullBackupSetDownloadRequest): CreateFullBackupSetDownloadResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFullBackupSetDownloadWithOptions(request, runtime);
}

model CreateGetDBListFromAgentTaskRequest {
  backupGatewayId?: long(name='BackupGatewayId'),
  clientToken?: string(name='ClientToken'),
  databaseType?: string(name='DatabaseType'),
  ownerId?: string(name='OwnerId'),
  sourceEndpointIP?: string(name='SourceEndpointIP'),
  sourceEndpointPort?: int32(name='SourceEndpointPort'),
  sourceEndpointRegion?: string(name='SourceEndpointRegion'),
}

model CreateGetDBListFromAgentTaskResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  taskId?: long(name='TaskId'),
}

model CreateGetDBListFromAgentTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateGetDBListFromAgentTaskResponseBody(name='body'),
}

async function createGetDBListFromAgentTaskWithOptions(request: CreateGetDBListFromAgentTaskRequest, runtime: Util.RuntimeOptions): CreateGetDBListFromAgentTaskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupGatewayId)) {
    query['BackupGatewayId'] = request.backupGatewayId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseType)) {
    query['DatabaseType'] = request.databaseType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.sourceEndpointIP)) {
    query['SourceEndpointIP'] = request.sourceEndpointIP;
  }
  if (!Util.isUnset(request.sourceEndpointPort)) {
    query['SourceEndpointPort'] = request.sourceEndpointPort;
  }
  if (!Util.isUnset(request.sourceEndpointRegion)) {
    query['SourceEndpointRegion'] = request.sourceEndpointRegion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateGetDBListFromAgentTask',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createGetDBListFromAgentTask(request: CreateGetDBListFromAgentTaskRequest): CreateGetDBListFromAgentTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return createGetDBListFromAgentTaskWithOptions(request, runtime);
}

model CreateIncrementBackupSetDownloadRequest {
  backupSetDataFormat?: string(name='BackupSetDataFormat'),
  backupSetId?: string(name='BackupSetId'),
  backupSetName?: string(name='BackupSetName'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model CreateIncrementBackupSetDownloadResponseBody = {
  backupSetDownloadTaskId?: string(name='BackupSetDownloadTaskId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateIncrementBackupSetDownloadResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateIncrementBackupSetDownloadResponseBody(name='body'),
}

async function createIncrementBackupSetDownloadWithOptions(request: CreateIncrementBackupSetDownloadRequest, runtime: Util.RuntimeOptions): CreateIncrementBackupSetDownloadResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupSetDataFormat)) {
    query['BackupSetDataFormat'] = request.backupSetDataFormat;
  }
  if (!Util.isUnset(request.backupSetId)) {
    query['BackupSetId'] = request.backupSetId;
  }
  if (!Util.isUnset(request.backupSetName)) {
    query['BackupSetName'] = request.backupSetName;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateIncrementBackupSetDownload',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createIncrementBackupSetDownload(request: CreateIncrementBackupSetDownloadRequest): CreateIncrementBackupSetDownloadResponse {
  var runtime = new Util.RuntimeOptions{};
  return createIncrementBackupSetDownloadWithOptions(request, runtime);
}

model CreateRestoreTaskRequest {
  backupGatewayId?: long(name='BackupGatewayId'),
  backupPlanId?: string(name='BackupPlanId'),
  backupSetId?: string(name='BackupSetId'),
  clientToken?: string(name='ClientToken'),
  crossAliyunId?: string(name='CrossAliyunId'),
  crossRoleName?: string(name='CrossRoleName'),
  destinationEndpointDatabaseName?: string(name='DestinationEndpointDatabaseName'),
  destinationEndpointIP?: string(name='DestinationEndpointIP'),
  destinationEndpointInstanceID?: string(name='DestinationEndpointInstanceID'),
  destinationEndpointInstanceType?: string(name='DestinationEndpointInstanceType'),
  destinationEndpointOracleSID?: string(name='DestinationEndpointOracleSID'),
  destinationEndpointPassword?: string(name='DestinationEndpointPassword'),
  destinationEndpointPort?: int32(name='DestinationEndpointPort'),
  destinationEndpointRegion?: string(name='DestinationEndpointRegion'),
  destinationEndpointUserName?: string(name='DestinationEndpointUserName'),
  duplicateConflict?: string(name='DuplicateConflict'),
  ownerId?: string(name='OwnerId'),
  restoreDir?: string(name='RestoreDir'),
  restoreHome?: string(name='RestoreHome'),
  restoreObjects?: string(name='RestoreObjects'),
  restoreTaskName?: string(name='RestoreTaskName'),
  restoreTime?: long(name='RestoreTime'),
}

model CreateRestoreTaskResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  restoreTaskId?: string(name='RestoreTaskId'),
  success?: boolean(name='Success'),
}

model CreateRestoreTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateRestoreTaskResponseBody(name='body'),
}

async function createRestoreTaskWithOptions(request: CreateRestoreTaskRequest, runtime: Util.RuntimeOptions): CreateRestoreTaskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupGatewayId)) {
    query['BackupGatewayId'] = request.backupGatewayId;
  }
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupSetId)) {
    query['BackupSetId'] = request.backupSetId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.crossAliyunId)) {
    query['CrossAliyunId'] = request.crossAliyunId;
  }
  if (!Util.isUnset(request.crossRoleName)) {
    query['CrossRoleName'] = request.crossRoleName;
  }
  if (!Util.isUnset(request.destinationEndpointDatabaseName)) {
    query['DestinationEndpointDatabaseName'] = request.destinationEndpointDatabaseName;
  }
  if (!Util.isUnset(request.destinationEndpointIP)) {
    query['DestinationEndpointIP'] = request.destinationEndpointIP;
  }
  if (!Util.isUnset(request.destinationEndpointInstanceID)) {
    query['DestinationEndpointInstanceID'] = request.destinationEndpointInstanceID;
  }
  if (!Util.isUnset(request.destinationEndpointInstanceType)) {
    query['DestinationEndpointInstanceType'] = request.destinationEndpointInstanceType;
  }
  if (!Util.isUnset(request.destinationEndpointOracleSID)) {
    query['DestinationEndpointOracleSID'] = request.destinationEndpointOracleSID;
  }
  if (!Util.isUnset(request.destinationEndpointPassword)) {
    query['DestinationEndpointPassword'] = request.destinationEndpointPassword;
  }
  if (!Util.isUnset(request.destinationEndpointPort)) {
    query['DestinationEndpointPort'] = request.destinationEndpointPort;
  }
  if (!Util.isUnset(request.destinationEndpointRegion)) {
    query['DestinationEndpointRegion'] = request.destinationEndpointRegion;
  }
  if (!Util.isUnset(request.destinationEndpointUserName)) {
    query['DestinationEndpointUserName'] = request.destinationEndpointUserName;
  }
  if (!Util.isUnset(request.duplicateConflict)) {
    query['DuplicateConflict'] = request.duplicateConflict;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.restoreDir)) {
    query['RestoreDir'] = request.restoreDir;
  }
  if (!Util.isUnset(request.restoreHome)) {
    query['RestoreHome'] = request.restoreHome;
  }
  if (!Util.isUnset(request.restoreObjects)) {
    query['RestoreObjects'] = request.restoreObjects;
  }
  if (!Util.isUnset(request.restoreTaskName)) {
    query['RestoreTaskName'] = request.restoreTaskName;
  }
  if (!Util.isUnset(request.restoreTime)) {
    query['RestoreTime'] = request.restoreTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateRestoreTask',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createRestoreTask(request: CreateRestoreTaskRequest): CreateRestoreTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return createRestoreTaskWithOptions(request, runtime);
}

model DescribeBackupGatewayListRequest {
  clientToken?: string(name='ClientToken'),
  identifier?: string(name='Identifier'),
  ownerId?: string(name='OwnerId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  region?: string(name='Region'),
}

model DescribeBackupGatewayListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    backupGateway?: [ 
    {
      backupGatewayCreateTime?: long(name='BackupGatewayCreateTime'),
      backupGatewayId?: string(name='BackupGatewayId'),
      backupGatewayStatus?: string(name='BackupGatewayStatus'),
      displayName?: string(name='DisplayName'),
      identifier?: string(name='Identifier'),
      lastHeartbeatTime?: long(name='LastHeartbeatTime'),
      region?: string(name='Region'),
      sourceEndpointHostname?: string(name='SourceEndpointHostname'),
      sourceEndpointInternetIP?: string(name='SourceEndpointInternetIP'),
      sourceEndpointIntranetIP?: string(name='SourceEndpointIntranetIP'),
    }
  ](name='BackupGateway')
  }(name='Items'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalElements?: int32(name='TotalElements'),
  totalPages?: int32(name='TotalPages'),
}

model DescribeBackupGatewayListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeBackupGatewayListResponseBody(name='body'),
}

async function describeBackupGatewayListWithOptions(request: DescribeBackupGatewayListRequest, runtime: Util.RuntimeOptions): DescribeBackupGatewayListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.identifier)) {
    query['Identifier'] = request.identifier;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupGatewayList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeBackupGatewayList(request: DescribeBackupGatewayListRequest): DescribeBackupGatewayListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupGatewayListWithOptions(request, runtime);
}

model DescribeBackupPlanBillingRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  showStorageType?: boolean(name='ShowStorageType'),
}

model DescribeBackupPlanBillingResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  item?: {
    buyChargeType?: string(name='BuyChargeType'),
    buyCreateTimestamp?: long(name='BuyCreateTimestamp'),
    buyExpiredTimestamp?: long(name='BuyExpiredTimestamp'),
    buySpec?: string(name='BuySpec'),
    contStorageSize?: long(name='ContStorageSize'),
    fullStorageSize?: long(name='FullStorageSize'),
    isExpired?: boolean(name='IsExpired'),
    isFreeBytesUnlimited?: boolean(name='IsFreeBytesUnlimited'),
    paiedBytes?: long(name='PaiedBytes'),
    quotaEndTimestamp?: long(name='QuotaEndTimestamp'),
    quotaStartTimestamp?: long(name='QuotaStartTimestamp'),
    totalFreeBytes?: long(name='TotalFreeBytes'),
    usedFullBytes?: long(name='UsedFullBytes'),
    usedIncrementBytes?: long(name='UsedIncrementBytes'),
  }(name='Item'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeBackupPlanBillingResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeBackupPlanBillingResponseBody(name='body'),
}

async function describeBackupPlanBillingWithOptions(request: DescribeBackupPlanBillingRequest, runtime: Util.RuntimeOptions): DescribeBackupPlanBillingResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.showStorageType)) {
    query['ShowStorageType'] = request.showStorageType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupPlanBilling',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeBackupPlanBilling(request: DescribeBackupPlanBillingRequest): DescribeBackupPlanBillingResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupPlanBillingWithOptions(request, runtime);
}

model DescribeBackupPlanListRequest {
  backupPlanId?: string(name='BackupPlanId'),
  backupPlanName?: string(name='BackupPlanName'),
  backupPlanStatus?: string(name='BackupPlanStatus'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  region?: string(name='Region'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DescribeBackupPlanListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    backupPlanDetail?: [ 
    {
      backupGatewayId?: long(name='BackupGatewayId'),
      backupMethod?: string(name='BackupMethod'),
      backupObjects?: string(name='BackupObjects'),
      backupPeriod?: string(name='BackupPeriod'),
      backupPlanCreateTime?: long(name='BackupPlanCreateTime'),
      backupPlanId?: string(name='BackupPlanId'),
      backupPlanName?: string(name='BackupPlanName'),
      backupPlanStatus?: string(name='BackupPlanStatus'),
      backupRetentionPeriod?: int32(name='BackupRetentionPeriod'),
      backupSetDownloadDir?: string(name='BackupSetDownloadDir'),
      backupSetDownloadFullDataFormat?: string(name='BackupSetDownloadFullDataFormat'),
      backupSetDownloadGatewayId?: long(name='BackupSetDownloadGatewayId'),
      backupSetDownloadIncrementDataFormat?: string(name='BackupSetDownloadIncrementDataFormat'),
      backupSetDownloadTargetType?: string(name='BackupSetDownloadTargetType'),
      backupStartTime?: string(name='BackupStartTime'),
      backupStorageType?: string(name='BackupStorageType'),
      beginTimestampForRestore?: long(name='BeginTimestampForRestore'),
      crossAliyunId?: string(name='CrossAliyunId'),
      crossRoleName?: string(name='CrossRoleName'),
      databaseType?: string(name='DatabaseType'),
      duplicationArchivePeriod?: int32(name='DuplicationArchivePeriod'),
      duplicationInfrequentAccessPeriod?: int32(name='DuplicationInfrequentAccessPeriod'),
      enableBackupLog?: boolean(name='EnableBackupLog'),
      endTimestampForRestore?: long(name='EndTimestampForRestore'),
      errMessage?: string(name='ErrMessage'),
      instanceClass?: string(name='InstanceClass'),
      OSSBucketName?: string(name='OSSBucketName'),
      OSSBucketRegion?: string(name='OSSBucketRegion'),
      openBackupSetAutoDownload?: boolean(name='OpenBackupSetAutoDownload'),
      resourceGroupId?: string(name='ResourceGroupId'),
      sourceEndpointDatabaseName?: string(name='SourceEndpointDatabaseName'),
      sourceEndpointInstanceID?: string(name='SourceEndpointInstanceID'),
      sourceEndpointInstanceType?: string(name='SourceEndpointInstanceType'),
      sourceEndpointIpPort?: string(name='SourceEndpointIpPort'),
      sourceEndpointOracleSID?: string(name='SourceEndpointOracleSID'),
      sourceEndpointRegion?: string(name='SourceEndpointRegion'),
      sourceEndpointUserName?: string(name='SourceEndpointUserName'),
    }
  ](name='BackupPlanDetail')
  }(name='Items'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalElements?: int32(name='TotalElements'),
  totalPages?: int32(name='TotalPages'),
}

model DescribeBackupPlanListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeBackupPlanListResponseBody(name='body'),
}

async function describeBackupPlanListWithOptions(request: DescribeBackupPlanListRequest, runtime: Util.RuntimeOptions): DescribeBackupPlanListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupPlanName)) {
    query['BackupPlanName'] = request.backupPlanName;
  }
  if (!Util.isUnset(request.backupPlanStatus)) {
    query['BackupPlanStatus'] = request.backupPlanStatus;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupPlanList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeBackupPlanList(request: DescribeBackupPlanListRequest): DescribeBackupPlanListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupPlanListWithOptions(request, runtime);
}

model DescribeBackupSetDownloadTaskListRequest {
  backupPlanId?: string(name='BackupPlanId'),
  backupSetDownloadTaskId?: string(name='BackupSetDownloadTaskId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
}

model DescribeBackupSetDownloadTaskListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    backupSetDownloadTaskDetail?: [ 
    {
      backupGatewayId?: long(name='BackupGatewayId'),
      backupPlanId?: string(name='BackupPlanId'),
      backupSetCode?: string(name='BackupSetCode'),
      backupSetDataFormat?: string(name='BackupSetDataFormat'),
      backupSetDataSize?: long(name='BackupSetDataSize'),
      backupSetDbType?: string(name='BackupSetDbType'),
      backupSetDownloadCreateTime?: long(name='BackupSetDownloadCreateTime'),
      backupSetDownloadDir?: string(name='BackupSetDownloadDir'),
      backupSetDownloadFinishTime?: long(name='BackupSetDownloadFinishTime'),
      backupSetDownloadInternetUrl?: string(name='BackupSetDownloadInternetUrl'),
      backupSetDownloadIntranetUrl?: string(name='BackupSetDownloadIntranetUrl'),
      backupSetDownloadStatus?: string(name='BackupSetDownloadStatus'),
      backupSetDownloadTargetType?: string(name='BackupSetDownloadTargetType'),
      backupSetDownloadTaskId?: string(name='BackupSetDownloadTaskId'),
      backupSetDownloadTaskName?: string(name='BackupSetDownloadTaskName'),
      backupSetDownloadWay?: string(name='BackupSetDownloadWay'),
      backupSetId?: string(name='BackupSetId'),
      backupSetJobType?: string(name='BackupSetJobType'),
      errMessage?: string(name='ErrMessage'),
    }
  ](name='BackupSetDownloadTaskDetail')
  }(name='Items'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalElements?: int32(name='TotalElements'),
  totalPages?: int32(name='TotalPages'),
}

model DescribeBackupSetDownloadTaskListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeBackupSetDownloadTaskListResponseBody(name='body'),
}

async function describeBackupSetDownloadTaskListWithOptions(request: DescribeBackupSetDownloadTaskListRequest, runtime: Util.RuntimeOptions): DescribeBackupSetDownloadTaskListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupSetDownloadTaskId)) {
    query['BackupSetDownloadTaskId'] = request.backupSetDownloadTaskId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupSetDownloadTaskList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeBackupSetDownloadTaskList(request: DescribeBackupSetDownloadTaskListRequest): DescribeBackupSetDownloadTaskListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupSetDownloadTaskListWithOptions(request, runtime);
}

model DescribeDLAServiceRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model DescribeDLAServiceResponseBody = {
  autoAdd?: boolean(name='AutoAdd'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  haveJobFailed?: boolean(name='HaveJobFailed'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  state?: string(name='State'),
  success?: boolean(name='Success'),
}

model DescribeDLAServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDLAServiceResponseBody(name='body'),
}

async function describeDLAServiceWithOptions(request: DescribeDLAServiceRequest, runtime: Util.RuntimeOptions): DescribeDLAServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDLAService',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeDLAService(request: DescribeDLAServiceRequest): DescribeDLAServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDLAServiceWithOptions(request, runtime);
}

model DescribeFullBackupListRequest {
  backupPlanId?: string(name='BackupPlanId'),
  backupSetId?: string(name='BackupSetId'),
  clientToken?: string(name='ClientToken'),
  endTimestamp?: long(name='EndTimestamp'),
  ownerId?: string(name='OwnerId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  showStorageType?: boolean(name='ShowStorageType'),
  startTimestamp?: long(name='StartTimestamp'),
}

model DescribeFullBackupListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    fullBackupFile?: [ 
    {
      backupObjects?: string(name='BackupObjects'),
      backupSetExpiredTime?: long(name='BackupSetExpiredTime'),
      backupSetId?: string(name='BackupSetId'),
      backupSize?: long(name='BackupSize'),
      backupStatus?: string(name='BackupStatus'),
      createTime?: long(name='CreateTime'),
      endTime?: long(name='EndTime'),
      errMessage?: string(name='ErrMessage'),
      finishTime?: long(name='FinishTime'),
      sourceEndpointIpPort?: string(name='SourceEndpointIpPort'),
      startTime?: long(name='StartTime'),
      storageMethod?: string(name='StorageMethod'),
    }
  ](name='FullBackupFile')
  }(name='Items'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalElements?: int32(name='TotalElements'),
  totalPages?: int32(name='TotalPages'),
}

model DescribeFullBackupListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeFullBackupListResponseBody(name='body'),
}

async function describeFullBackupListWithOptions(request: DescribeFullBackupListRequest, runtime: Util.RuntimeOptions): DescribeFullBackupListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupSetId)) {
    query['BackupSetId'] = request.backupSetId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.showStorageType)) {
    query['ShowStorageType'] = request.showStorageType;
  }
  if (!Util.isUnset(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeFullBackupList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeFullBackupList(request: DescribeFullBackupListRequest): DescribeFullBackupListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeFullBackupListWithOptions(request, runtime);
}

model DescribeIncrementBackupListRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  endTimestamp?: long(name='EndTimestamp'),
  ownerId?: string(name='OwnerId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  showStorageType?: boolean(name='ShowStorageType'),
  startTimestamp?: long(name='StartTimestamp'),
}

model DescribeIncrementBackupListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    incrementBackupFile?: [ 
    {
      backupSetExpiredTime?: long(name='BackupSetExpiredTime'),
      backupSetId?: string(name='BackupSetId'),
      backupSetJobId?: string(name='BackupSetJobId'),
      backupSize?: long(name='BackupSize'),
      backupStatus?: string(name='BackupStatus'),
      endTime?: long(name='EndTime'),
      sourceEndpointIpPort?: string(name='SourceEndpointIpPort'),
      startTime?: long(name='StartTime'),
      storageMethod?: string(name='StorageMethod'),
    }
  ](name='IncrementBackupFile')
  }(name='Items'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalElements?: int32(name='TotalElements'),
  totalPages?: int32(name='TotalPages'),
}

model DescribeIncrementBackupListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeIncrementBackupListResponseBody(name='body'),
}

async function describeIncrementBackupListWithOptions(request: DescribeIncrementBackupListRequest, runtime: Util.RuntimeOptions): DescribeIncrementBackupListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.showStorageType)) {
    query['ShowStorageType'] = request.showStorageType;
  }
  if (!Util.isUnset(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeIncrementBackupList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeIncrementBackupList(request: DescribeIncrementBackupListRequest): DescribeIncrementBackupListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeIncrementBackupListWithOptions(request, runtime);
}

model DescribeJobErrorCodeRequest {
  clientToken?: string(name='ClientToken'),
  language?: string(name='Language'),
  ownerId?: string(name='OwnerId'),
  taskId?: string(name='TaskId'),
}

model DescribeJobErrorCodeResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  item?: {
    errorCode?: string(name='ErrorCode'),
    errorMessage?: string(name='ErrorMessage'),
    jobId?: string(name='JobId'),
    jobState?: string(name='JobState'),
    jobType?: string(name='JobType'),
    language?: string(name='Language'),
  }(name='Item'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeJobErrorCodeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeJobErrorCodeResponseBody(name='body'),
}

async function describeJobErrorCodeWithOptions(request: DescribeJobErrorCodeRequest, runtime: Util.RuntimeOptions): DescribeJobErrorCodeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeJobErrorCode',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeJobErrorCode(request: DescribeJobErrorCodeRequest): DescribeJobErrorCodeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeJobErrorCodeWithOptions(request, runtime);
}

model DescribeNodeCidrListRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  region?: string(name='Region'),
}

model DescribeNodeCidrListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  internetIPs?: {
    internetIP?: [ string ](name='InternetIP')
  }(name='InternetIPs'),
  intranetIPs?: {
    intranetIP?: [ string ](name='IntranetIP')
  }(name='IntranetIPs'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeNodeCidrListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeNodeCidrListResponseBody(name='body'),
}

async function describeNodeCidrListWithOptions(request: DescribeNodeCidrListRequest, runtime: Util.RuntimeOptions): DescribeNodeCidrListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeNodeCidrList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeNodeCidrList(request: DescribeNodeCidrListRequest): DescribeNodeCidrListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeNodeCidrListWithOptions(request, runtime);
}

model DescribePreCheckProgressListRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  restoreTaskId?: string(name='RestoreTaskId'),
}

model DescribePreCheckProgressListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    preCheckProgressDetail?: [ 
    {
      bootTime?: long(name='BootTime'),
      errMsg?: string(name='ErrMsg'),
      finishTime?: long(name='FinishTime'),
      item?: string(name='Item'),
      jobId?: string(name='JobId'),
      names?: string(name='Names'),
      orderNum?: string(name='OrderNum'),
      state?: string(name='State'),
    }
  ](name='PreCheckProgressDetail')
  }(name='Items'),
  progress?: int32(name='Progress'),
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
  success?: boolean(name='Success'),
}

model DescribePreCheckProgressListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribePreCheckProgressListResponseBody(name='body'),
}

async function describePreCheckProgressListWithOptions(request: DescribePreCheckProgressListRequest, runtime: Util.RuntimeOptions): DescribePreCheckProgressListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.restoreTaskId)) {
    query['RestoreTaskId'] = request.restoreTaskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribePreCheckProgressList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describePreCheckProgressList(request: DescribePreCheckProgressListRequest): DescribePreCheckProgressListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePreCheckProgressListWithOptions(request, runtime);
}

model DescribeRegionsRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model DescribeRegionsResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  regions?: {
    regionCode?: [ string ](name='RegionCode')
  }(name='Regions'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeRegionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeRegionsResponseBody(name='body'),
}

async function describeRegionsWithOptions(request: DescribeRegionsRequest, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegions',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRegionsWithOptions(request, runtime);
}

model DescribeRestoreRangeInfoRequest {
  backupPlanId?: string(name='BackupPlanId'),
  beginTimestampForRestore?: long(name='BeginTimestampForRestore'),
  clientToken?: string(name='ClientToken'),
  endTimestampForRestore?: long(name='EndTimestampForRestore'),
  ownerId?: string(name='OwnerId'),
  recentlyRestore?: boolean(name='RecentlyRestore'),
}

model DescribeRestoreRangeInfoResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    DBSRecoverRange?: [ 
    {
      beginTimestampForRestore?: long(name='BeginTimestampForRestore'),
      endTimestampForRestore?: long(name='EndTimestampForRestore'),
      fullBackupList?: {
        fullBackupDetail?: [ 
        {
          backupSetId?: string(name='BackupSetId'),
          endTime?: long(name='EndTime'),
          startTime?: long(name='StartTime'),
        }
      ](name='FullBackupDetail')
      }(name='FullBackupList'),
      rangeType?: string(name='RangeType'),
      sourceEndpointInstanceID?: string(name='SourceEndpointInstanceID'),
      sourceEndpointInstanceType?: string(name='SourceEndpointInstanceType'),
    }
  ](name='DBSRecoverRange')
  }(name='Items'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DescribeRestoreRangeInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeRestoreRangeInfoResponseBody(name='body'),
}

async function describeRestoreRangeInfoWithOptions(request: DescribeRestoreRangeInfoRequest, runtime: Util.RuntimeOptions): DescribeRestoreRangeInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.beginTimestampForRestore)) {
    query['BeginTimestampForRestore'] = request.beginTimestampForRestore;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.endTimestampForRestore)) {
    query['EndTimestampForRestore'] = request.endTimestampForRestore;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.recentlyRestore)) {
    query['RecentlyRestore'] = request.recentlyRestore;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRestoreRangeInfo',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeRestoreRangeInfo(request: DescribeRestoreRangeInfoRequest): DescribeRestoreRangeInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRestoreRangeInfoWithOptions(request, runtime);
}

model DescribeRestoreTaskListRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  endTimestamp?: long(name='EndTimestamp'),
  ownerId?: string(name='OwnerId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  restoreTaskId?: string(name='RestoreTaskId'),
  startTimestamp?: long(name='StartTimestamp'),
}

model DescribeRestoreTaskListResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  items?: {
    restoreTaskDetail?: [ 
    {
      backupGatewayId?: long(name='BackupGatewayId'),
      backupPlanId?: string(name='BackupPlanId'),
      backupSetId?: string(name='BackupSetId'),
      continuousRestoreProgress?: int32(name='ContinuousRestoreProgress'),
      crossAliyunId?: string(name='CrossAliyunId'),
      crossRoleName?: string(name='CrossRoleName'),
      destinationEndpointDatabaseName?: string(name='DestinationEndpointDatabaseName'),
      destinationEndpointInstanceID?: string(name='DestinationEndpointInstanceID'),
      destinationEndpointInstanceType?: string(name='DestinationEndpointInstanceType'),
      destinationEndpointIpPort?: string(name='DestinationEndpointIpPort'),
      destinationEndpointOracleSID?: string(name='DestinationEndpointOracleSID'),
      destinationEndpointRegion?: string(name='DestinationEndpointRegion'),
      destinationEndpointUserName?: string(name='DestinationEndpointUserName'),
      errMessage?: string(name='ErrMessage'),
      fullDataRestoreProgress?: int32(name='FullDataRestoreProgress'),
      fullStruAfterRestoreProgress?: int32(name='FullStruAfterRestoreProgress'),
      fullStruforeRestoreProgress?: int32(name='FullStruforeRestoreProgress'),
      restoreDir?: string(name='RestoreDir'),
      restoreObjects?: string(name='RestoreObjects'),
      restoreStatus?: string(name='RestoreStatus'),
      restoreTaskCreateTime?: long(name='RestoreTaskCreateTime'),
      restoreTaskFinishTime?: long(name='RestoreTaskFinishTime'),
      restoreTaskId?: string(name='RestoreTaskId'),
      restoreTaskName?: string(name='RestoreTaskName'),
      restoreTime?: long(name='RestoreTime'),
    }
  ](name='RestoreTaskDetail')
  }(name='Items'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalElements?: int32(name='TotalElements'),
  totalPages?: int32(name='TotalPages'),
}

model DescribeRestoreTaskListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeRestoreTaskListResponseBody(name='body'),
}

async function describeRestoreTaskListWithOptions(request: DescribeRestoreTaskListRequest, runtime: Util.RuntimeOptions): DescribeRestoreTaskListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.restoreTaskId)) {
    query['RestoreTaskId'] = request.restoreTaskId;
  }
  if (!Util.isUnset(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRestoreTaskList',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeRestoreTaskList(request: DescribeRestoreTaskListRequest): DescribeRestoreTaskListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRestoreTaskListWithOptions(request, runtime);
}

model DisableBackupLogRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model DisableBackupLogResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  needPrecheck?: boolean(name='NeedPrecheck'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DisableBackupLogResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisableBackupLogResponseBody(name='body'),
}

async function disableBackupLogWithOptions(request: DisableBackupLogRequest, runtime: Util.RuntimeOptions): DisableBackupLogResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisableBackupLog',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disableBackupLog(request: DisableBackupLogRequest): DisableBackupLogResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableBackupLogWithOptions(request, runtime);
}

model EnableBackupLogRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model EnableBackupLogResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  needPrecheck?: boolean(name='NeedPrecheck'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model EnableBackupLogResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: EnableBackupLogResponseBody(name='body'),
}

async function enableBackupLogWithOptions(request: EnableBackupLogRequest, runtime: Util.RuntimeOptions): EnableBackupLogResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EnableBackupLog',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function enableBackupLog(request: EnableBackupLogRequest): EnableBackupLogResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableBackupLogWithOptions(request, runtime);
}

model GetDBListFromAgentRequest {
  backupGatewayId?: long(name='BackupGatewayId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  sourceEndpointRegion?: string(name='SourceEndpointRegion'),
  taskId?: long(name='TaskId'),
}

model GetDBListFromAgentResponseBody = {
  dbList?: {
    dbName?: [ string ](name='dbName')
  }(name='DbList'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetDBListFromAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetDBListFromAgentResponseBody(name='body'),
}

async function getDBListFromAgentWithOptions(request: GetDBListFromAgentRequest, runtime: Util.RuntimeOptions): GetDBListFromAgentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupGatewayId)) {
    query['BackupGatewayId'] = request.backupGatewayId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.sourceEndpointRegion)) {
    query['SourceEndpointRegion'] = request.sourceEndpointRegion;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDBListFromAgent',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getDBListFromAgent(request: GetDBListFromAgentRequest): GetDBListFromAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDBListFromAgentWithOptions(request, runtime);
}

model InitializeDbsServiceLinkedRoleResponseBody = {
  data?: string(name='Data'),
  errMessage?: string(name='ErrMessage'),
  errorCode?: string(name='ErrorCode'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model InitializeDbsServiceLinkedRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: InitializeDbsServiceLinkedRoleResponseBody(name='body'),
}

async function initializeDbsServiceLinkedRoleWithOptions(runtime: Util.RuntimeOptions): InitializeDbsServiceLinkedRoleResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'InitializeDbsServiceLinkedRole',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function initializeDbsServiceLinkedRole(): InitializeDbsServiceLinkedRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return initializeDbsServiceLinkedRoleWithOptions(runtime);
}

model ModifyBackupObjectsRequest {
  backupObjects?: string(name='BackupObjects'),
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model ModifyBackupObjectsResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  needPrecheck?: boolean(name='NeedPrecheck'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyBackupObjectsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyBackupObjectsResponseBody(name='body'),
}

async function modifyBackupObjectsWithOptions(request: ModifyBackupObjectsRequest, runtime: Util.RuntimeOptions): ModifyBackupObjectsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupObjects)) {
    query['BackupObjects'] = request.backupObjects;
  }
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyBackupObjects',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyBackupObjects(request: ModifyBackupObjectsRequest): ModifyBackupObjectsResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyBackupObjectsWithOptions(request, runtime);
}

model ModifyBackupPlanNameRequest {
  backupPlanId?: string(name='BackupPlanId'),
  backupPlanName?: string(name='BackupPlanName'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model ModifyBackupPlanNameResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyBackupPlanNameResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyBackupPlanNameResponseBody(name='body'),
}

async function modifyBackupPlanNameWithOptions(request: ModifyBackupPlanNameRequest, runtime: Util.RuntimeOptions): ModifyBackupPlanNameResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupPlanName)) {
    query['BackupPlanName'] = request.backupPlanName;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyBackupPlanName',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyBackupPlanName(request: ModifyBackupPlanNameRequest): ModifyBackupPlanNameResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyBackupPlanNameWithOptions(request, runtime);
}

model ModifyBackupSetDownloadRulesRequest {
  backupGatewayId?: long(name='BackupGatewayId'),
  backupPlanId?: string(name='BackupPlanId'),
  backupSetDownloadDir?: string(name='BackupSetDownloadDir'),
  backupSetDownloadTargetType?: string(name='BackupSetDownloadTargetType'),
  backupSetDownloadTargetTypeLocation?: string(name='BackupSetDownloadTargetTypeLocation'),
  clientToken?: string(name='ClientToken'),
  fullDataFormat?: string(name='FullDataFormat'),
  incrementDataFormat?: string(name='IncrementDataFormat'),
  openAutoDownload?: boolean(name='OpenAutoDownload'),
  ownerId?: string(name='OwnerId'),
}

model ModifyBackupSetDownloadRulesResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyBackupSetDownloadRulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyBackupSetDownloadRulesResponseBody(name='body'),
}

async function modifyBackupSetDownloadRulesWithOptions(request: ModifyBackupSetDownloadRulesRequest, runtime: Util.RuntimeOptions): ModifyBackupSetDownloadRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupGatewayId)) {
    query['BackupGatewayId'] = request.backupGatewayId;
  }
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupSetDownloadDir)) {
    query['BackupSetDownloadDir'] = request.backupSetDownloadDir;
  }
  if (!Util.isUnset(request.backupSetDownloadTargetType)) {
    query['BackupSetDownloadTargetType'] = request.backupSetDownloadTargetType;
  }
  if (!Util.isUnset(request.backupSetDownloadTargetTypeLocation)) {
    query['BackupSetDownloadTargetTypeLocation'] = request.backupSetDownloadTargetTypeLocation;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.fullDataFormat)) {
    query['FullDataFormat'] = request.fullDataFormat;
  }
  if (!Util.isUnset(request.incrementDataFormat)) {
    query['IncrementDataFormat'] = request.incrementDataFormat;
  }
  if (!Util.isUnset(request.openAutoDownload)) {
    query['OpenAutoDownload'] = request.openAutoDownload;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyBackupSetDownloadRules',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyBackupSetDownloadRules(request: ModifyBackupSetDownloadRulesRequest): ModifyBackupSetDownloadRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyBackupSetDownloadRulesWithOptions(request, runtime);
}

model ModifyBackupSourceEndpointRequest {
  backupGatewayId?: long(name='BackupGatewayId'),
  backupObjects?: string(name='BackupObjects'),
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  crossAliyunId?: string(name='CrossAliyunId'),
  crossRoleName?: string(name='CrossRoleName'),
  ownerId?: string(name='OwnerId'),
  sourceEndpointDatabaseName?: string(name='SourceEndpointDatabaseName'),
  sourceEndpointIP?: string(name='SourceEndpointIP'),
  sourceEndpointInstanceID?: string(name='SourceEndpointInstanceID'),
  sourceEndpointInstanceType?: string(name='SourceEndpointInstanceType'),
  sourceEndpointOracleSID?: string(name='SourceEndpointOracleSID'),
  sourceEndpointPassword?: string(name='SourceEndpointPassword'),
  sourceEndpointPort?: int32(name='SourceEndpointPort'),
  sourceEndpointRegion?: string(name='SourceEndpointRegion'),
  sourceEndpointUserName?: string(name='SourceEndpointUserName'),
}

model ModifyBackupSourceEndpointResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  needPrecheck?: boolean(name='NeedPrecheck'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyBackupSourceEndpointResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyBackupSourceEndpointResponseBody(name='body'),
}

async function modifyBackupSourceEndpointWithOptions(request: ModifyBackupSourceEndpointRequest, runtime: Util.RuntimeOptions): ModifyBackupSourceEndpointResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupGatewayId)) {
    query['BackupGatewayId'] = request.backupGatewayId;
  }
  if (!Util.isUnset(request.backupObjects)) {
    query['BackupObjects'] = request.backupObjects;
  }
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.crossAliyunId)) {
    query['CrossAliyunId'] = request.crossAliyunId;
  }
  if (!Util.isUnset(request.crossRoleName)) {
    query['CrossRoleName'] = request.crossRoleName;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.sourceEndpointDatabaseName)) {
    query['SourceEndpointDatabaseName'] = request.sourceEndpointDatabaseName;
  }
  if (!Util.isUnset(request.sourceEndpointIP)) {
    query['SourceEndpointIP'] = request.sourceEndpointIP;
  }
  if (!Util.isUnset(request.sourceEndpointInstanceID)) {
    query['SourceEndpointInstanceID'] = request.sourceEndpointInstanceID;
  }
  if (!Util.isUnset(request.sourceEndpointInstanceType)) {
    query['SourceEndpointInstanceType'] = request.sourceEndpointInstanceType;
  }
  if (!Util.isUnset(request.sourceEndpointOracleSID)) {
    query['SourceEndpointOracleSID'] = request.sourceEndpointOracleSID;
  }
  if (!Util.isUnset(request.sourceEndpointPassword)) {
    query['SourceEndpointPassword'] = request.sourceEndpointPassword;
  }
  if (!Util.isUnset(request.sourceEndpointPort)) {
    query['SourceEndpointPort'] = request.sourceEndpointPort;
  }
  if (!Util.isUnset(request.sourceEndpointRegion)) {
    query['SourceEndpointRegion'] = request.sourceEndpointRegion;
  }
  if (!Util.isUnset(request.sourceEndpointUserName)) {
    query['SourceEndpointUserName'] = request.sourceEndpointUserName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyBackupSourceEndpoint',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyBackupSourceEndpoint(request: ModifyBackupSourceEndpointRequest): ModifyBackupSourceEndpointResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyBackupSourceEndpointWithOptions(request, runtime);
}

model ModifyBackupStrategyRequest {
  backupLogIntervalSeconds?: int32(name='BackupLogIntervalSeconds'),
  backupPeriod?: string(name='BackupPeriod'),
  backupPlanId?: string(name='BackupPlanId'),
  backupStartTime?: string(name='BackupStartTime'),
  backupStrategyType?: string(name='BackupStrategyType'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model ModifyBackupStrategyResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  needPrecheck?: boolean(name='NeedPrecheck'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyBackupStrategyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyBackupStrategyResponseBody(name='body'),
}

async function modifyBackupStrategyWithOptions(request: ModifyBackupStrategyRequest, runtime: Util.RuntimeOptions): ModifyBackupStrategyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupLogIntervalSeconds)) {
    query['BackupLogIntervalSeconds'] = request.backupLogIntervalSeconds;
  }
  if (!Util.isUnset(request.backupPeriod)) {
    query['BackupPeriod'] = request.backupPeriod;
  }
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupStartTime)) {
    query['BackupStartTime'] = request.backupStartTime;
  }
  if (!Util.isUnset(request.backupStrategyType)) {
    query['BackupStrategyType'] = request.backupStrategyType;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyBackupStrategy',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyBackupStrategy(request: ModifyBackupStrategyRequest): ModifyBackupStrategyResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyBackupStrategyWithOptions(request, runtime);
}

model ModifyStorageStrategyRequest {
  backupPlanId?: string(name='BackupPlanId'),
  backupRetentionPeriod?: int32(name='BackupRetentionPeriod'),
  clientToken?: string(name='ClientToken'),
  duplicationArchivePeriod?: int32(name='DuplicationArchivePeriod'),
  duplicationInfrequentAccessPeriod?: int32(name='DuplicationInfrequentAccessPeriod'),
  ownerId?: string(name='OwnerId'),
}

model ModifyStorageStrategyResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  needPrecheck?: boolean(name='NeedPrecheck'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ModifyStorageStrategyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyStorageStrategyResponseBody(name='body'),
}

async function modifyStorageStrategyWithOptions(request: ModifyStorageStrategyRequest, runtime: Util.RuntimeOptions): ModifyStorageStrategyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupRetentionPeriod)) {
    query['BackupRetentionPeriod'] = request.backupRetentionPeriod;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.duplicationArchivePeriod)) {
    query['DuplicationArchivePeriod'] = request.duplicationArchivePeriod;
  }
  if (!Util.isUnset(request.duplicationInfrequentAccessPeriod)) {
    query['DuplicationInfrequentAccessPeriod'] = request.duplicationInfrequentAccessPeriod;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyStorageStrategy',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyStorageStrategy(request: ModifyStorageStrategyRequest): ModifyStorageStrategyResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyStorageStrategyWithOptions(request, runtime);
}

model ReleaseBackupPlanRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model ReleaseBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ReleaseBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReleaseBackupPlanResponseBody(name='body'),
}

async function releaseBackupPlanWithOptions(request: ReleaseBackupPlanRequest, runtime: Util.RuntimeOptions): ReleaseBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function releaseBackupPlan(request: ReleaseBackupPlanRequest): ReleaseBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseBackupPlanWithOptions(request, runtime);
}

model RenewBackupPlanRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  period?: string(name='Period'),
  usedTime?: int32(name='UsedTime'),
}

model RenewBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  orderId?: string(name='OrderId'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RenewBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RenewBackupPlanResponseBody(name='body'),
}

async function renewBackupPlanWithOptions(request: RenewBackupPlanRequest, runtime: Util.RuntimeOptions): RenewBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.usedTime)) {
    query['UsedTime'] = request.usedTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RenewBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function renewBackupPlan(request: RenewBackupPlanRequest): RenewBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewBackupPlanWithOptions(request, runtime);
}

model StartBackupPlanRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
}

model StartBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  createdFullBackupsetId?: string(name='CreatedFullBackupsetId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StartBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartBackupPlanResponseBody(name='body'),
}

async function startBackupPlanWithOptions(request: StartBackupPlanRequest, runtime: Util.RuntimeOptions): StartBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startBackupPlan(request: StartBackupPlanRequest): StartBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return startBackupPlanWithOptions(request, runtime);
}

model StartRestoreTaskRequest {
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  restoreTaskId?: string(name='RestoreTaskId'),
}

model StartRestoreTaskResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  restoreTaskId?: string(name='RestoreTaskId'),
  success?: boolean(name='Success'),
}

model StartRestoreTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartRestoreTaskResponseBody(name='body'),
}

async function startRestoreTaskWithOptions(request: StartRestoreTaskRequest, runtime: Util.RuntimeOptions): StartRestoreTaskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.restoreTaskId)) {
    query['RestoreTaskId'] = request.restoreTaskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartRestoreTask',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startRestoreTask(request: StartRestoreTaskRequest): StartRestoreTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return startRestoreTaskWithOptions(request, runtime);
}

model StopBackupPlanRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  ownerId?: string(name='OwnerId'),
  stopMethod?: string(name='StopMethod'),
}

model StopBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StopBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StopBackupPlanResponseBody(name='body'),
}

async function stopBackupPlanWithOptions(request: StopBackupPlanRequest, runtime: Util.RuntimeOptions): StopBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.stopMethod)) {
    query['StopMethod'] = request.stopMethod;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopBackupPlan(request: StopBackupPlanRequest): StopBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopBackupPlanWithOptions(request, runtime);
}

model UpgradeBackupPlanRequest {
  backupPlanId?: string(name='BackupPlanId'),
  clientToken?: string(name='ClientToken'),
  instanceClass?: string(name='InstanceClass'),
  ownerId?: string(name='OwnerId'),
}

model UpgradeBackupPlanResponseBody = {
  backupPlanId?: string(name='BackupPlanId'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  orderId?: string(name='OrderId'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpgradeBackupPlanResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpgradeBackupPlanResponseBody(name='body'),
}

async function upgradeBackupPlanWithOptions(request: UpgradeBackupPlanRequest, runtime: Util.RuntimeOptions): UpgradeBackupPlanResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceClass)) {
    query['InstanceClass'] = request.instanceClass;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeBackupPlan',
    version = '2019-03-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function upgradeBackupPlan(request: UpgradeBackupPlanRequest): UpgradeBackupPlanResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradeBackupPlanWithOptions(request, runtime);
}

